<!DOCTYPE html>
<html>
<head>
    <title>FMSGroup资产管理系统 - {{ $device['name'] }}</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        .device-info {
            background: #f8f9fa;
            border-radius: 8px;
            padding: 20px;
            margin-bottom: 30px;
        }
        .device-info dt {
            font-weight: 600;
            color: #6c757d;
        }
        .parts-table {
            box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
        }
    </style>
</head>
<body>
    



    
    <div class="container py-5">
        <!-- 设备信息 -->
        <div class="device-info">
            <h2 class="mb-4">资产设备信息</h2>
            <dl class="row">
                <dt class="col-sm-2">资产编号</dt>
                <dd class="col-sm-4">{{ $device['Asset_Number'] }}</dd>

                <dt class="col-sm-2">设备名称</dt>
                <dd class="col-sm-4">{{ $device['name'] }}</dd>

                <dt class="col-sm-2">分类</dt>
                <dd class="col-sm-4">{{ $device['category'] }}</dd>

                <dt class="col-sm-2">位置</dt>
                <dd class="col-sm-4">{{ $device['location'] }}</dd>

                <dt class="col-sm-2">负责人</dt>
                <dd class="col-sm-4">{{ $device['User_id'] }}</dd>

                <dt class="col-sm-2">状态</dt>
                <dd class="col-sm-4">
                    <span class="badge bg-{{ $device['State'] === '正常' ? 'success' : 'danger' }}">
                        {{ $device['State'] }}
                    </span>
                </dd>
            </dl>
        </div>

        <!-- 零件表格 -->
       <h3 class="mb-3">设备配件清单</h3>
<div class="table-responsive parts-table">
    <table class="table table-striped table-hover">
        <thead class="table-dark">
            <tr>
                <th>ID</th>
                <th>资产编号</th>
                <th>分类</th> <!-- 修改列名 -->
                <th>名称</th>
                <th>序列号</th>
                <th>规格</th>
                <th>厂商</th> <!-- 修改列名 -->
                <th>状态</th>
                <th>创建时间</th>
            </tr>
        </thead>
        <tbody>
            @forelse($parts as $part)
            <tr>
                <td>{{ $part->id }}</td>
                <td>{{ $part->asset_number }}</td>
                <td>{{ $part->partCategory->PartCategory ?? '未知分类' }}</td>
                <td>{{ $part->name }}</td>
                <td>{{ $part->Part_serial_number ?? '-' }}</td>
                <td>{{ $part->specification ?? '-' }}</td>
                <td>{{ $part->Manufacturer->manufacturer ?? '未知厂商' }}</td>
                <td>
                    <span class="badge bg-{{ $part->state === '正常' ? 'success' : 'danger' }}">
                        {{ $part->state }}
                    </span>
                </td>
                <td>{{ $part->created_at }}</td>
            </tr>
            @empty
            <tr>
                <td colspan="9" class="text-center text-muted">暂无零件数据</td>
            </tr>
            @endforelse
        </tbody>
    </table>
</div>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>